package Utils;

import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import common.ApplcationVariable;
import model.UserInfo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * 得到登录用户
 */
public class SessionUtil {
    public static UserInfo getSessionUserInfo(HttpServletRequest req){
        HttpSession session=req.getSession(false);
        UserInfo userInfo=null;
        if(session!=null && session.getAttribute(ApplcationVariable.SESSION_USER_KEY)!=null){
            //已登录
            userInfo= (UserInfo) session.getAttribute(ApplcationVariable.SESSION_USER_KEY);
        }
        return userInfo;
    }
}
